import 'dart:convert';

import 'package:OASys/httpConfig/EntityFactory.dart';

class MenuTreeVo {
  int id;
  String name;
  String route;
  int status;
  String statusName;
  List<MenuTreeVo> children;

  MenuTreeVo({
    this.id,
    this.name,
    this.status,
    this.statusName,
    this.children,
  });

  MenuTreeVo.fromJson(Map<String, dynamic> json) {
    List<MenuTreeVo> menuTreeVoList = new List<MenuTreeVo>();

    if (json['children'] != null) {
      (json['children'] as List).forEach((v) {
        menuTreeVoList.add(EntityFactory.generateOBJ<MenuTreeVo>(v));
      });
    }
    id = json['id'];
    name = json['name'];
    route = json['route'];
    status = json['status'];
    statusName = json['statusName'];
    children = menuTreeVoList;
  }
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['route'] = this.route;
    data['status'] = this.status;
    data['statusName'] = this.statusName;
    data['children'] = json.encode(this.children);
    return data;
  }
}
